package com.student.demo.controller;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.student.demo.entity.NianJiZhuanYe;
import com.student.demo.service.NianJiZhuanYeService;

@Controller
@RequestMapping("classNianji")
public class ClassNianJiController {
   @Resource
   private NianJiZhuanYeService nianJiZhuanYeService;
   
   @RequestMapping("addNianJiView")
   public String addNianJiView() {
	   return "addNianJiView";
   }
   
   @PostMapping("addNianJi")  
   public String addNianJi(NianJiZhuanYe nianJiZhuanYe) {
	   nianJiZhuanYeService.addNianJiZhuanYe(nianJiZhuanYe);
	   return "redirect:nianJiZhuanYes";
   }
   
   @RequestMapping("nianJiZhuanYes")
   public String nianJiZhuanYes(Map<String,Object> map) {
	   List<NianJiZhuanYe> findAll = nianJiZhuanYeService.findAll();
	   map.put("findAll", findAll);
	   return "nianJiZhuanYes";
   }
   
   
}
